<?php

$data = array();
$student_id = $_GET['student_id'];

$result = $dbfunc->query("SELECT * FROM tb_student WHERE student_id='{$student_id}'");
$data['student'] = mysql_fetch_assoc($result);

$sql = "select * from tb_sec NATURAL JOIN tb_teacher NATURAL JOIN tb_subject NATURAL JOIN tb_plan NATURAL JOIN tb_room NATURAL JOIN tb_student WHERE student_id='{$student_id}'";
$result = $dbfunc->query($sql);
while($item = mysql_fetch_assoc($result)){
    $data['plan'][] = $item;
}
$result = $dbfunc->query("SELECT * FROM tb_reg NATURAL JOIN tb_sec NATURAL JOIN tb_teacher NATURAL JOIN tb_subject WHERE student_id='{$student_id}'");
while($item = mysql_fetch_assoc($result)){
	$data['reg'][] = $item;
}

echo json_encode($data);